package com.feicheng.controller.wx;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.feicheng.common.result.ResultInfo;
import com.feicheng.persistence.entity.Afj;
import com.feicheng.persistence.entity.Amdhxq;
import com.feicheng.persistence.service.IAfjService;
import com.feicheng.persistence.service.IAmdhxqService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/wx/hxq")
public class HxqController {

    @Autowired
    IAmdhxqService iAmdhxqService;

    @PostMapping("/list/get")
    public ResultInfo getHxqByList(@RequestBody JSONObject param) {
        QueryWrapper<Amdhxq> qw = new QueryWrapper<>();

        String mdid = param.getString("mdid");
        if (StringUtils.hasLength(mdid)) {
            qw.eq("mdid", mdid);
        }

        String fjid = param.getString("fjid");
        if (StringUtils.hasLength(fjid)) {
            qw.eq("fjid", fjid);
        }

        String clientid = param.getString("clientid");
        if (StringUtils.hasLength(clientid)) {
            qw.eq("clientid", clientid);
        }


        param.put("hxqs", iAmdhxqService.list(qw));
        return ResultInfo.success(param);
    }



}
